home *** CD-ROM | disk | FTP | other *** search
- Path: kelvin.physics.mun.ca!cdeacon
- From: cdeacon@kelvin.physics.mun.ca (Chris Deacon)
- Newsgroups: comp.lang.c
- Subject: Function wanted to evaluate string
- Date: 16 Feb 1996 13:22:32 GMT
- Organization: Physics Dept at Memorial University NF
- Distribution: world
- Message-ID: <4g20eo$623@coranto.ucs.mun.ca>
- Reply-To: cdeacon@kelvin.physics.mun.ca (Chris Deacon)
- NNTP-Posting-Host: kelvin.physics.mun.ca
- X-Newsreader: mxrn 6.18-30
-
-
- I want a function which will evaluate a string of numbers and
- arithmetic operators. That is, whwn I call
-
- eval_func(2*5)
-
- a value of 10 will be returned.
-
- Ideally, I'd like the code to be able to handle several operators
- in the string, so that
-
- eval_func((3*5.7)/(2-.77)+4.5)
-
- will be evaluated just as easily.
-
- All suggestions gratefully appreciated..
-
- Chris
- --
- +-----------------------------+-------------------------------------+
- | Christopher Deacon | (709) 737-7631 |
- | Physics Department | cdeacon@kelvin.physics.mun.ca !
- | Memorial University of Nfld | http://www.physics.mun.ca/~cdeacon |
- +-----------------------------+-------------------------------------+
-
-